<template>
  <div>
    <div class="page_box">
      <template>
        <el-tabs v-model="activeName" @tab-click="changeTab">
          <el-tab-pane label="全部" name="1">
             <span slot="label"> 全部
               <span class="tab-badge">{{all}}</span>
             </span>
          </el-tab-pane>
          <el-tab-pane label="已处理" name="2">
               <span slot="label"> 已处理
               <span class="tab-badge">{{allReady}}</span>
             </span>
          </el-tab-pane>
          <el-tab-pane label="未处理" name="3">
                <span slot="label"> 未处理
               <span class="tab-badge">{{undisposed}}</span>
             </span>
          </el-tab-pane>
        </el-tabs>
      </template>
      <!-- 列表 -->
      <el-card shadow="hover" class="box-card" v-for="(item, index) in needData" :key="index">
        <el-form :model="item" label-width="100px">
          <el-row>
            <el-col :span="7">
              <el-form-item label="需求类型：">
                <div>{{item.type}}</div>
              </el-form-item>
            </el-col>
            <el-col :span="7">
              <el-form-item label="联系方式：">{{item.phone}}</el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="处理结果：">
                <template>
                  <el-tag v-if="item.state == 1" type="success" size="mini">已处理</el-tag>
                  <el-tag v-else-if="2" type="danger" size="mini">未处理</el-tag>
                  <el-tag v-else type="warning" size="mini">处理中</el-tag>
                </template>
              </el-form-item>
            </el-col>
            <el-col :span="2">
              <el-form-item>
                <template >
                  <el-button size="mini" @click="editState(index)" icon="el-icon-edit">编辑</el-button>
                </template>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="需求概述：">{{item.content}}</el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
      <div class="page-box">
        <el-pagination
          background
          small
          :current-page="current_page"
          :page-size="per_page"
          layout="total, prev, pager, next, jumper"
          :total="10"
          @current-change="changePage"
        ></el-pagination>
      </div>
    </div>
    <!-- 修改处理状态弹窗 -->
    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
       <el-radio-group v-model="radio">
        <el-radio :label="1">已处理</el-radio>
        <el-radio :label="2">处理中</el-radio>
        <el-radio :label="3">未处理</el-radio>
      </el-radio-group>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
        <el-button size="mini" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      all:20,
      allReady:10,
      undisposed:4,
      radio:1,
      dialogVisible: false,
      current_page: 1,
      per_page: 5,
      needData: [
        {
          type: "衣服定制",
          phone: "15896965858",
          state: 1,
          content: "随机发个工具佛教佛安居房"
        },
        {
          type: "衣服定制",
          phone: "15896965858",
          state: 2,
          content: "随机发个工具佛教佛安居房"
        }
      ],
      activeName: "1"
    };
  },
  methods: {
    changePage() {
      console.log(1);
    },
    changeTab(e) {
      console.log(e);
    },
    editState(index) {
      console.log(index)
      this.dialogVisible = true;
      this.radio = this.needData[index].state
    }
  }
};
</script>

<style scoped>
@import url("../../assets/css/active/need/nedd.css");
</style>